package com.yunfeisoft.business.service.impl;

import com.applet.base.BaseServiceImpl;
import com.applet.sql.separation.DataSourceChange;
import com.applet.utils.Page;
import com.yunfeisoft.business.dao.inter.OmsOrderSettingDao;
import com.yunfeisoft.business.model.OmsOrderSetting;
import com.yunfeisoft.business.service.inter.OmsOrderSettingService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: OmsOrderSettingServiceImpl
 * Description: 订单设置表service实现
 * Author: Jackie liu
 * Date: 2020-06-02
 */
@Service("omsOrderSettingService")
public class OmsOrderSettingServiceImpl extends BaseServiceImpl<OmsOrderSetting, String, OmsOrderSettingDao> implements OmsOrderSettingService {

    @Override
    @DataSourceChange(slave = true)
    public Page<OmsOrderSetting> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int save(OmsOrderSetting omsOrderSetting) {
        OmsOrderSetting oms_order_setting = getDao().load("oms_order_setting");
        if (oms_order_setting != null) {
            return getDao().updateForce(omsOrderSetting);
        }
        return super.save(omsOrderSetting);
    }
}